<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Alex
 * Created Time: 2019/6/23 22:15
 * Modified Time: 2019/6/23 22:15
 * Version: 2.0
 */

namespace App\Modules\Order\Validators;

use Flower\Core\Repository\Contracts\ValidatorInterface;
use Flower\Core\Repository\Validator\LaravelValidator;

class OrderValidator extends LaravelValidator
{
	protected $rules = [
		ValidatorInterface::RULE_CREATE => [
			'order_no'         => 'sometimes|required|unique:order',
			'store_id'         => 'sometimes|required',
			'barber_id'        => 'sometimes|required',
			'member_id'        => 'sometimes|required',
			'appointment_time' => 'sometimes|required',
			'real_price'       => 'numeric',
			'price'            => 'numeric',
			'is_pay'           => 'boolean',
			'is_appoint'       => 'boolean',
			'is_evaluate'      => 'boolean'
		]
	];
	protected $messages = [
		'order_no.required'         => '订单号不能为空',
		'order_no.unique'           => '订单号重复，请重新提交！',
		'store_id.required'         => '店铺id不能为空',
		'barber_id.required'        => '理发师id不能为空',
		'member_id.required'        => '客户id不能为空',
		'appointment_time.required' => '预约时间不能为空！',
		'real_price.numeric'        => '实际付款总价必须为数字',
		'price.numeric'             => '服务总价必须为数字',
		'is_pay'                    => '是否付款字段的数值必须能够被转换为布尔值',
		'is_appoint'                => '是否指定理发师字段的数值必须能够被转换为布尔值',
		'is_evaluate'               => '是否评价字段的数值必须能够被转换为布尔值'
	];
}